package com.example.demo.result;

public class JsonResult<T> {
    private int code;
    private String msg;
    private T data;

    public static JsonResult ok(){
        JsonResult<Object> result = new JsonResult<>();
        result.setCode(200);
        result.setMsg("操作成功");
        return  result;
    }

    public static JsonResult ok(Object data){
        JsonResult<Object> result = new JsonResult<>();
        result.setCode(200);
        result.setMsg("操作成功");
        result.setData(data);
        return  result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
